package org.nepu.scr.indexrate.converter.drillingrate.jobarticulation;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobarticulation.WellControlRisk;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class WellControlRiskConverter implements AttributeConverter<WellControlRisk, String> {
    @Override
    public String convertToDatabaseColumn(WellControlRisk wellControlRisk) {
        return JSONUtil.toJsonStr(wellControlRisk);
    }

    @Override
    public WellControlRisk convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, WellControlRisk.class);
    }
}
